#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file    lenet.py
@brief
@details
@author  Shivelino
@date    2023-12-23 19:06
@version 0.0.1

@par Copyright(c):
@par todo:
@par history:
"""
import torch
import torch.nn as nn


class LeNet(nn.Module):
    """LeNet"""

    def __init__(self):
        super(LeNet, self).__init__()
        self.conv1 = nn.Conv2d(1, 6, kernel_size=5)
        self.conv2 = nn.Conv2d(6, 16, kernel_size=5)
        self.fc1 = nn.Linear(16 * 4 * 4, 120)
        self.fc2 = nn.Linear(120, 84)
        self.fc3 = nn.Linear(84, 10)

    def forward(self, x):
        x = torch.relu(self.conv1(x))
        x = torch.max_pool2d(x, 2)
        x = torch.relu(self.conv2(x))
        x = torch.max_pool2d(x, 2)
        x = x.view(x.size(0), -1)
        x = torch.relu(self.fc1(x))
        x = torch.relu(self.fc2(x))
        x = self.fc3(x)
        return x
